﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FarseerGames.FarseerPhysics;
using FarseerGames.FarseerPhysics.Factories;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using XNA_2DFramwork;

namespace City_War_Game
{
    class PlayerAi : Player
    {
        private PlayerControler playerControler;
        public PlayerAi(Game Game, Vector2 position, int width, int height, string filename, GraphicsDevice gd, PhysicsSimulator physicsSimulator) : base(Game, position, width, height, filename, gd, physicsSimulator)
        {
            PhysicsSimulator = physicsSimulator;
            Position = position;
            //---------------------------------------------------------------------------------------
            Texture = Game.Content.Load<Texture2D>(filename);
            Width = width;
            Height = height;
            Origin = new Vector2(Width / 2f, Height / 2f);
            SpriteBatch = new SpriteBatch(gd);
            Body = BodyFactory.Instance.CreateRectangleBody(PhysicsSimulator, Width, Height, 1);
            Body.Position = position;
            Geom = GeomFactory.Instance.CreateRectangleGeom(PhysicsSimulator, Body, Width, Height);
            Geom.FrictionCoefficient = 1;
            playerControler = new PlayerControler(Game,this);
        }

        public override void Update()
        {
            playerControler.Update();
            base.Update();
        }
    }
}
